﻿using System.IO;
using FileTransfer.Client.Http.Client;

// ReSharper disable once CheckNamespace
namespace FileTransfer.Client.Http.Api;

public partial class ShareItemControllerApi
{
    public Uri GetShareItemFilesCall(string code, string md5, string fileName)
    {
        if (code == null)
            throw new ApiException(
                400,
                "Missing required parameter 'code' when calling ShareItemControllerApi->GetShareItemFiles"
            );
        if (md5 == null)
            throw new ApiException(
                400,
                "Missing required parameter 'md5' when calling ShareItemControllerApi->GetShareItemFiles"
            );
        if (fileName == null)
            throw new ApiException(
                400,
                "Missing required parameter 'fileName' when calling ShareItemControllerApi->GetShareItemFiles"
            );
        var options = new RequestOptions();
        var contentTypes = new string[] { };
        var accepts = new[] { "*/*" };
        var localVarContentType = ClientUtils.SelectHeaderContentType(contentTypes);
        options.HeaderParameters.Add("Content-Type", localVarContentType);
        var localVarAccept = ClientUtils.SelectHeaderAccept(accepts);
        options.HeaderParameters.Add("Accept", localVarAccept);
        options.PathParameters.Add("code", ClientUtils.ParameterToString(code)); // path parameter
        options.PathParameters.Add("md5", ClientUtils.ParameterToString(md5)); // path parameter
        options.PathParameters.Add("fileName", ClientUtils.ParameterToString(fileName)); // path parameter

        var builder = new WebRequestPathBuilder(
            GetBasePath(),
            "/api/share/{code}/{md5}/{fileName}"
        );

        builder.AddPathParameters(options.PathParameters);

        builder.AddQueryParameters(options.QueryParameters);

        return new Uri(builder.GetFullUri());
    }
}
